var num = 26;
var itemPerPage = 8;
var page = 1;

NextPage = function()
{
	GoPage(page+1);
}

PrevPage = function()
{
	GoPage(page-1);
}

HideButton = function(pageId)
{
	if(page == 1)
		document.getElementById("prev").innerText = "-";
	else
		document.getElementById("prev").innerText = "Prev";
	
	if(Math.ceil(num/itemPerPage) > pageId)
		document.getElementById("next").innerText = "Next";
	else
		document.getElementById("next").innerText = "-";
}

GoPage = function(pageId)
{
	page = pageId;
	if(Math.ceil(num/itemPerPage) < pageId)
		document.getElementById("page").innerText = "Cannot Navigate";
	else
	{
		var from = ((pageId-1) * itemPerPage + 1);
		var to = (itemPerPage * pageId);
		if(to > num)
			to = num;
		document.getElementById("page").innerText = "Page " + pageId;
		document.getElementById("record").innerText = "records " + from + "-" + to;
	}
	HideButton(pageId);
}
callLoad = function () {
GoPage(1);
};

window.onload = callLoad;
